package com.itheima.d1_properties;

import java.io.*;
import java.util.Properties;

/*
    目标：掌握把键值对数据存入到属性文件中去
        public void store(OutputStream os, String comments)	把键值对数据，通过字节输出流写出到属性文件里去
        public void store(Writer w, String comments)	把键值对数据，通过字符输出流写出到属性文件里去
        public void load(InputStream is)	通过字节输入流，读取属性文件里的键值对数据
        public void load(Reader reader)	通过字符输入流，读取属性文件里的键值对数据
 */
public class PropertiesTest2 {
    public static void main(String[] args) throws IOException {
        Properties prop = new Properties();

//        proper(prop);
        prop.load(new FileReader("ww.properties"));
        System.out.println(prop);
    }

    private static void proper(Properties prop) throws IOException {
        prop.setProperty("张三", "22");
        prop.setProperty("lisi", "28");
        prop.setProperty("wangweu", "12");
        prop.setProperty("xiaoguo", "29");
//        prop.store(new OutputStreamWriter(new FileOutputStream("ww.properties"),"UTF-8"),"1");
        prop.store(new FileWriter("ww.properties"),"000");

    }
}
